// 加密函数
const secretKey = "***"

export function encrypt(data: string) {
    return `${secretKey}${data}${secretKey}`
}

function escapeRegExp(str: string) {
    // 把正则中的特殊字符都转义掉
    return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

export function decrypt(data: string) {
    const safeKey = escapeRegExp(secretKey);
    return data.replace(new RegExp(safeKey, "g"), "");
}
